home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Miscellaneous / WBStars2.0 / source / WBStars_libraries.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-24  |  1.2 KB  |  40 lines

  1. /* $VER: WBStars_libraries.c 2.0b4 (29 May 1997)
  2. */
  3.  
  4. #include <proto/exec.h>
  5.  
  6. #include "WBStars_include.h"
  7. #include "WBStars_protos.h"
  8.  
  9. struct IntuitionBase    *IntuitionBase=NULL;
  10. struct GfxBase        *GfxBase=NULL;
  11. struct Library        *CxBase=NULL;
  12. struct Library        *IconBase=NULL;
  13. struct Library        *LayersBase=NULL;
  14. char OS3=FALSE;
  15.  
  16. char    OpenLibraries()        /* opens all needed libraries    */
  17. {                /* returns TRUE on success    */
  18.     IntuitionBase    =(struct IntuitionBase*)OpenLibrary("intuition.library",0L);
  19.     CxBase        =OpenLibrary("commodities.library",37L);
  20.     IconBase    =OpenLibrary("icon.library",36L);
  21.     LayersBase    =OpenLibrary("layers.library",0L);
  22.     if(GfxBase    =(struct GfxBase*)OpenLibrary("graphics.library",39L))
  23.         {OS3=TRUE;}else
  24.         {GfxBase=(struct GfxBase*)OpenLibrary("graphics.library",0L);}
  25.  
  26.     if( !IntuitionBase || !GfxBase || !CxBase || !IconBase || !LayersBase )
  27.     {
  28.         return FALSE;
  29.     }
  30.     return TRUE;
  31. }
  32.  
  33. void    CloseLibraries()    /* closes all opened libraries    */
  34. {
  35.     if(IntuitionBase)    CloseLibrary((struct Library*)IntuitionBase);
  36.     if(GfxBase)        CloseLibrary((struct Library*)GfxBase);
  37.     if(CxBase)        CloseLibrary(CxBase);
  38.     if(IconBase)        CloseLibrary(IconBase);
  39.     if(LayersBase)        CloseLibrary(LayersBase);
  40. }